package main

import (
	"fmt"
	"time"

	"git.inke.cn/BackendPlatform/golang/kafka"
	"git.inke.cn/inkelogic/daenerys"
	"golang.org/x/net/context"
)

const name = "producter"

func main() {
	err := daenerys.Default.InitKafkaProducer([]kafka.KafkaProductConfig{
		kafka.KafkaProductConfig{
			ProducerTo: name,
			Broken:     "ali-e-inf-qa01.bj:9092,ali-e-inf-qa02.bj:9092,ali-e-inf-qa03.bj:9092,ali-e-inf-qa04.bj:9092,ali-e-inf-qa05.bj:9092",
			UseSync:    true,
		},
	})
	if err != nil {
		panic(err)
		return
	}

	producter := daenerys.SyncProducerClient(context.TODO(), name)
	for i := 1; i <= 10; i++ {
		producter.SendSyncMsg("nvwa_controlcenter_controlcenter_cloud_base_something_changed", fmt.Sprintf("%d", time.Now().Unix()), []byte(fmt.Sprintf("msg=%d\n", i)))
	}
}

//
